package org.hegang.design.first.abstractfactorypattern;

import org.hegang.design.first.abstractfactorypattern.impl.Circle;
import org.hegang.design.first.abstractfactorypattern.impl.Rectangle;
import org.hegang.design.first.abstractfactorypattern.impl.Square;
import org.hegang.design.common.CommonFields;

/**
 * @ClassName ShapeFactory
 * @Describe: 形状工厂类
 * @Author: gang.he
 * @Email: SmileSkylife@outlook.com
 * @Date: Created in 22:35 2019/6/28
 * @Modified By:
 * @Version V1.0
 */
public class ShapeFactory extends AbstractFactory{
    @Override
    public Shape getShape(String shapeType){
        if(null == shapeType){
            return null;
        }
        if(shapeType.trim().equalsIgnoreCase(CommonFields.RECTANGLE)){
            return new Rectangle();
        }else if(shapeType.trim().equalsIgnoreCase(CommonFields.SQUARE)){
            return new Square();
        }else if(shapeType.trim().equalsIgnoreCase(CommonFields.CIRCLE)){
            return new Circle();
        }
        return null;
    }

    @Override
    public Color getColor(String color) {
        return null;
    }

}
